home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Makefiles / app / bundle.make < prev    next >
Text File  |  1994-06-29  |  11KB  |  296 lines

  1. #
  2. #                                 bundle.make
  3. #
  4. # Inputs from Makefile.preamble (no defaults):
  5. #    BUNDLELDFLAGS - Additional flags passed to ld when linking bundles
  6. #    OTHER_CFLAGS - Flags passed to compiler (in addition to -g, -O, etc.)
  7. #    OTHER_OFILES - Additional relocatables that may be linked in
  8. #    OTHER_PRODUCT_DEPENDS - Other dependencies of this project
  9. #    OTHER_SOURCEFILES - Other source files maintained by .pre/postamble
  10. #    OTHER_GARBAGE - Additional files to be removed by make 'clean' 
  11. #
  12. #    MSGFILES - .msg files that should have msgwrap run on them
  13. #    DEFSFILES - .defs files that should have mig run on them
  14. #    MIGFILES - .mig files (no .defs files) that should have mig run on them
  15. #
  16. #    PRECOMPS - Precompiled headers that should be built before compilation 
  17. #    OTHER_INITIAL_TARGETS - Targets to be built before subprojects, etc.
  18. #
  19. #    DSTROOT - Virtual root directory prepended to $(INSTALLDIR)
  20. #
  21. # Inputs from Makefile.postamble (with defaults set by this file):
  22. #    MAKEFILES - Makefiles this project depends on (default = Makefile)
  23. #    DEFAULT_CFLAGS - All compiler flags for this level (default set below)
  24. #
  25. # Inputs from Makefile (avoid setting these, ProjectBuilder controls them):
  26. #    NAME - name of application
  27. #    LANGUAGE - langage in which the project is written (default "English")
  28. #    LOCAL_RESOURCES - localized resources (e.g. nib's, images) of project
  29. #    GLOBAL_RESOURCES - non-localized resources of project
  30. #
  31. #    CLASSES - Class implementation files in project.
  32. #    HFILES - Header files in project.
  33. #    MFILES - Other Objective-C source files in project. 
  34. #    CFILES - Other C source files in project. 
  35. #    PSWFILES - .psw files in the project
  36. #    PSWMFILES - .pswm files in the project
  37. #    SUBPROJECTS - Subprojects of this project
  38. #    BUNDLES - Bundle subprojects of this project
  39. #    OTHERSRCS - Other miscellaneous sources of this project
  40. #    OTHERLINKED - Source files not matching a standard source extention
  41. #    OTHERLINKEDOFILES - Other relocatable files to (always) link in.
  42. #
  43. #    APP_MAKEFILE_DIR - Directory in which to find generic set of Makefiles
  44. #    MAKEFILEDIR - Directory in which to find $(MAKEFILE)
  45. #    MAKEFILE - Top level mechanism Makefile (e.g., app.make, bundle.make)
  46. #    INSTALLDIR - Directory app will be installed into by 'install' target
  47. #
  48.  
  49.  
  50. # Defaults for NeXT-specific Release Control options
  51. SRCROOT = .
  52. SYMROOT = .
  53. OBJROOT = .
  54.  
  55. # Set these in case this is a standalone case (much of this cruftiness has to do with sh's inability to operate on $$bun in the common.make subcomponents rule)
  56.  
  57. DOT = .
  58. BUNDLE_DIR = $(SYMROOT)/$(NAME).bproj
  59. PRODUCT_ROOT_WITHOUT_EXT = $(BUNDLE_DIR:.bproj=)
  60. PRODUCT_ROOT = $(PRODUCT_ROOT_WITHOUT_EXT).$(BUNDLE_EXTENSION)
  61. BUNDLE = $(PRODUCT_ROOT)/$(NAME)
  62.  
  63. # ...and relative versions for installing the bundle.
  64. REL_BUNDLE_DIR = $(NAME).bproj
  65. REL_PRODUCT_ROOT = $(REL_BUNDLE_DIR:.bproj=).$(BUNDLE_EXTENSION)
  66. REL_BUNDLE = $(REL_PRODUCT_ROOT)/$(NAME)
  67.  
  68. APP_MAKEFILE_DIR = /NextDeveloper/Makefiles/app
  69. include $(APP_MAKEFILE_DIR)/common.make
  70. include $(APP_MAKEFILE_DIR)/specialrules.make
  71.  
  72. all bundle:: 
  73.     @($(MKDIRS) $(PRODUCT_ROOT) ; \
  74.     $(process_target_archs)_obj ; \
  75.     $(set_bundle_ext) ; \
  76.     if [ "$(ENGLISH)" = "YES" -o "$(JAPANESE)" != "YES" ] ; then \
  77.         language_cflags='' ; \
  78.     else \
  79.         language_cflags='-DKANJI' ; \
  80.     fi ; \
  81.     $(MAKE) actual_project \
  82.         "OFILE_DIR = $(OBJROOT)/$$obj_dir" \
  83.         "PROJ_CFLAGS = $(NORMAL_CFLAGS) $$language_cflags" \
  84.         "MAKEFILEDIR = $(MAKEFILEDIR)" \
  85.         "BUNDLE_EXTENSION = $$bundle_ext" \
  86.         "DEVROOT = $(DEVROOT)" \
  87.         "RC_CFLAGS = $$arch_cflags" \
  88.         "RC_ARCHS = $$archs" \
  89.         "SRCROOT = $(SRCROOT)" \
  90.         "OBJROOT = $(OBJROOT)" \
  91.         "PRODUCT_ROOT = $(PRODUCT_ROOT_WITHOUT_EXT).$$bundle_ext" \
  92.         "SYMROOT = $(SYMROOT)/sym" \
  93.         "SYM_DIR = $(SYMROOT)/sym" )
  94.  
  95. debug::
  96.     @($(MKDIRS) $(PRODUCT_ROOT) ; \
  97.     $(process_target_archs)_debug_obj ; \
  98.     $(set_bundle_ext) ; \
  99.     if [ "$(ENGLISH)" = "YES" -o "$(JAPANESE)" != "YES" ] ; then \
  100.         language_cflags='' ; \
  101.     else \
  102.         language_cflags='-DKANJI' ; \
  103.     fi ; \
  104.     $(MAKE) actual_project \
  105.         "OFILE_DIR = $(OBJROOT)/$$obj_dir" \
  106.         "PROJ_CFLAGS = $(DEBUG_CFLAGS) $$language_cflags" \
  107.         "MAKEFILEDIR = $(MAKEFILEDIR)" \
  108.         "BUNDLE_EXTENSION = $$bundle_ext" \
  109.         "DEVROOT = $(DEVROOT)" \
  110.         "RC_CFLAGS = $$arch_cflags" \
  111.         "RC_ARCHS = $$archs" \
  112.         "SRCROOT = $(SRCROOT)" \
  113.         "OBJROOT = $(OBJROOT)" \
  114.         "PRODUCT_ROOT = $(PRODUCT_ROOT_WITHOUT_EXT).$$bundle_ext" \
  115.         "SYMROOT = $(SYMROOT)/sym" \
  116.         "SYM_DIR = $(SYMROOT)/sym" )
  117.  
  118.  
  119. profile::
  120.     @($(MKDIRS) $(PRODUCT_ROOT) ; \
  121.     $(process_target_archs)_profile_obj ; \
  122.     $(set_bundle_ext) ; \
  123.     if [ "$(ENGLISH)" = "YES" -o "$(JAPANESE)" != "YES" ] ; then \
  124.         language_cflags='' ; \
  125.     else \
  126.         language_cflags='-DKANJI' ; \
  127.     fi ; \
  128.     $(MAKE) actual_project \
  129.         "OFILE_DIR = $(OBJROOT)/$$obj_dir" \
  130.         "PROJ_CFLAGS = $(PROFILE_CFLAGS) $$language_cflags" \
  131.         "MAKEFILEDIR = $(MAKEFILEDIR)" \
  132.         "BUNDLE_EXTENSION = $$bundle_ext" \
  133.         "DEVROOT = $(DEVROOT)" \
  134.         "RC_CFLAGS = $$arch_cflags" \
  135.         "RC_ARCHS = $$archs" \
  136.         "SRCROOT = $(SRCROOT)" \
  137.         "OBJROOT = $(OBJROOT)" \
  138.         "PRODUCT_ROOT = $(PRODUCT_ROOT_WITHOUT_EXT).$$bundle_ext" \
  139.         "SYMROOT = $(SYMROOT)/sym" \
  140.         "SYM_DIR = $(SYMROOT)/sym" )
  141.  
  142. # The 'project' target should set BUNDLE_EXTENSION as appropriate. We need an
  143. # extra level of recursion here to insure this hhappens when this bundle is 
  144. # part of an app.  Note that the variables passed hrough here must match those 
  145. # in the bundle target in common.make.
  146.  
  147. project:: 
  148.     @($(set_bundle_ext) ; \
  149.     $(MAKE) actual_project \
  150.                 "TOP_PRODUCT_ROOT = $(TOP_PRODUCT_ROOT)" \
  151.                 "PRODUCT_ROOT = $(PRODUCT_ROOT)" \
  152.                        "BUNDLE_DIR = $(BUNDLE_DIR)" \
  153.                        "REL_BUNDLE_DIR = $(REL_BUNDLE_DIR)" \
  154.                "OFILE_DIR = $(OFILE_DIR)" \
  155.                "SYM_DIR = $(SYM_DIR)" \
  156.                "APP_MAKEFILE_DIR = $(APP_MAKEFILE_DIR)" \
  157.                "BUNDLE_EXTENSION = $$bundle_ext" \
  158.                "DEVROOT = $(DEVROOT)" \
  159.                "SRCROOT = $(SRCROOT)" \
  160.                "OBJROOT = $(OBJROOT)" \
  161.                "SYMROOT = $(SYMROOT)" \
  162.                "PROJ_CFLAGS = $(PROJ_CFLAGS)" \
  163.                "RC_ARCHS = $(RC_ARCHS)" \
  164.                "RC_CFLAGS = $(RC_CFLAGS)" )
  165.  
  166. actual_project:: $(INITIAL_TARGETS) subprojs bundles tools resources $(BUNDLE)
  167.  
  168. TEMP_C_FILE = $(SYM_DIR)/$(NAME)_empty.c
  169.  
  170. $(BUNDLE): $(PRODUCT_DEPENDS) $(PRODUCT_ROOT) $(SYM_DIR)
  171.     @(if [ "`$(ECHO) $(OFILES) $(OTHER_OFILES) | wc -w`" != "       0" ] ; then \
  172.        cmd="$(CC) $(ALL_CFLAGS) -nostdlib $(BUNDLELDFLAGS) $(OFILES) $(OTHER_OFILES) $(BUNDLE_LIBS) -r -o $(BUNDLE)" ; \
  173.        echo $$cmd ; $$cmd ; \
  174.     else \
  175.        $(ECHO) Warning: Building empty bundle. ; \
  176.        $(RM) -f $(TEMP_C_FILE) ; \
  177.        $(TOUCH) $(TEMP_C_FILE) ; \
  178.        $(CC) $(ALL_CFLAGS) -c $(TEMP_C_FILE) -o $(BUNDLE) ; \
  179.        $(RM) -f $(TEMP_C_FILE) ; \
  180.     fi ; \
  181.     $(CHMOD) a+x $(BUNDLE) )
  182.  
  183. depend:: Makefile.dependencies $(SUBPROJECTS:.subproj=.depend) $(BUNDLES:.bproj=.depend) $(TOOLS:.tproj=.depend)
  184.  
  185. $(PRODUCT_ROOT) \
  186. $(DSTROOT)$(INSTALLDIR):
  187.     $(MKDIRS) $@
  188.  
  189. THING_TO_STRIP = $(DSTROOT)$(PARENT_DIR)/$(NAME).$$bundle_ext/$(NAME)
  190.  
  191. strip_myself::
  192.     @($(set_bundle_ext) ; \
  193.         bundle_dir_name_base=$(REL_BUNDLE_DIR:.bproj=) ; \
  194.     bundle_dir_name=$$bundle_dir_name_base.$$bundle_ext ; \
  195.     $(RM) -f $(DSTROOT)$(PARENT_DIR)/$$bundle_dir_name/$(CHANGES_FILE); \
  196.     echo Removed $(DSTROOT)$(PARENT_DIR)/$$bundle_dir_name/$(CHANGES_FILE); \
  197.     if [ -f $(THING_TO_STRIP) ] ; then \
  198.         cmd="$(STRIP) $(RELOCATABLE_STRIP_OPTS) $(THING_TO_STRIP)" ; \
  199.         echo $$cmd ; $$cmd ; \
  200.     else \
  201.         echo Warning: Not able to strip $(THING_TO_STRIP) ; \
  202.     fi)
  203.  
  204. .bproj.strip .tproj.strip:
  205.     @($(set_bundle_ext) ; \
  206.     cd $<; \
  207.     $(MAKE) strip "DSTROOT = $(DSTROOT)" \
  208.               "PARENT_DIR = $(PARENT_DIR)/$(NAME).$$bundle_ext" \
  209.               "NAME=$*")
  210.  
  211.  
  212. before_install:: $(DSTROOT)$(INSTALLDIR)
  213.     @($(set_bundle_ext) ; \
  214.     cmd="$(RM) -rf $(DSTROOT)$(INSTALLDIR)/$(REL_BUNDLE_DIR:.bproj=).$$bundle_ext" ; \
  215.     echo $$cmd ; $$cmd )
  216.  
  217. after_install::
  218.  
  219. # Note that the following will not correctly install a standalone
  220. # bundle under a Jasper build.  
  221.  
  222. install:: bundle before_install installhdrs $(OTHER_INSTALL_DEPENDS)
  223.     @($(set_bundle_ext) ; \
  224.         bundle_dir_name_base=$(REL_BUNDLE_DIR:.bproj=) ; \
  225.     bundle_dir_name=$$bundle_dir_name_base.$$bundle_ext ; \
  226.     $(MKDIRS) $(DSTROOT)$(INSTALLDIR) ; \
  227.     $(ECHO) Tar\'ing $$bundle_dir_name to $(DSTROOT)$(INSTALLDIR) ; \
  228.     (cd $(SYMROOT); $(TAR) chf - $$bundle_dir_name) | \
  229.         (cd $(DSTROOT)$(INSTALLDIR); $(TAR) xf -) ; \
  230.     $(MAKE) strip "DSTROOT = $(DSTROOT)" \
  231.               "PARENT_DIR = $(INSTALLDIR)" \
  232.               "BUNDLE_EXTENSION = $(BUNDLE_EXTENSION)" ; \
  233.     cmd="$(CHOWN) -Rf $(INSTALL_AS_USER).$(INSTALL_AS_GROUP) $(DSTROOT)$(INSTALLDIR)/$$bundle_dir_name" ; \
  234.     $(ECHO) $$cmd ; \
  235.     $$cmd || $(ECHO) Couldn\'t chown $(DSTROOT)$(INSTALLDIR)/$$bundle_dir_name ; \
  236.     cmd="$(CHMOD) -Rf go-w $(DSTROOT)$(INSTALLDIR)/$$bundle_dir_name" ; \
  237.     $(ECHO) $$cmd ; \
  238.     $$cmd || $(ECHO) Couldn\'t chmod $(DSTROOT)$(INSTALLDIR)/$$bundle_dir_name ; \
  239.     if [ "$(INSTALL_PERMISSIONS)" != "" ] ; then \
  240.         $(ECHO) $(CHMOD) -f $(INSTALL_PERMISSIONS) \
  241.           $(DSTROOT)$(INSTALLDIR)/$$bundle_dir_name; \
  242.         $(CHMOD) -f $(INSTALL_PERMISSIONS) \
  243.           $(DSTROOT)$(INSTALLDIR)/$$bundle_dir_name; \
  244.     fi ; \
  245.     $(process_target_archs)_obj ; \
  246.     $(MAKE) after_install     "DSTROOT=$(DSTROOT)" \
  247.                        "OBJROOT=$(OBJROOT)" \
  248.                        "SYMROOT=$(SYMROOT)" \
  249.                 "DEVROOT = $(DEVROOT)" \
  250.                 "INSTALLDIR = $(INSTALLDIR)" \
  251.                 "PRODUCT_ROOT = $(PRODUCT_ROOT)" \
  252.                 "REL_PRODUCT_ROOT = $$bundle_dir_name" \
  253.                 "SYM_DIR = $(SYMROOT)/sym" \
  254.                 "OFILE_DIR = $(OBJROOT)/$$obj_dir" \
  255.                 "PROJ_CFLAGS = $(NORMAL_CFLAGS)" \
  256.                 "APP_MAKEFILE_DIR = $(APP_MAKEFILE_DIR)" \
  257.                 "BUNDLE_EXTENSION = $$bundle_ext" \
  258.                 "RC_CFLAGS = $$arch_cflags" \
  259.                 "RC_ARCHS = $$archs" )
  260.  
  261.  
  262.  
  263. #.DEFAULT 
  264.  
  265. help:
  266.     @if (test "$<"); then        \
  267.         $(ECHO) 'ERROR: Unrecognized Makefile target "$<"';    \
  268.     fi
  269.     @$(ECHO) 'The following targets are available:'
  270.     @$(ECHO) 
  271.     @$(ECHO) ' all         Makes the bundle target (below).  This is the default target.'
  272.     @$(ECHO) 
  273.     @$(ECHO) ' bundle      Compiles and links an optimized (and debuggable) version of the'
  274.     @$(ECHO) '             bundle into $(NAME).$(BUNDLE_EXTENSION)'
  275.     @$(ECHO)     
  276.     @$(ECHO) ' depend      Generates an optional Makefile.dependencies file for every level'
  277.     @$(ECHO) '             of the bundle to reflect the complete dependency graph'
  278.     @$(ECHO) '             (including headers).'
  279.     @$(ECHO) 
  280.     @$(ECHO) ' install     Builds (if needed) and copies <BundleName>.$(BUNDLE_EXTENSION)'
  281.     @$(ECHO) '             into the installation directory, setting permissions'
  282.     @$(ECHO) '             and owners as appropriate.'
  283.     @$(ECHO)     
  284.     @$(ECHO) ' installsrc  Installs the source files for the bundle into the directory'
  285.     @$(ECHO) '             specified in the SRCROOT variable in a command-line argument.'
  286.     @$(ECHO) '             Note: the target directory will be removed and recreated.'
  287.     @$(ECHO) 
  288.     @$(ECHO) ' installhdrs Installs the header files for the bundle.'
  289.     @$(ECHO) 
  290.     @$(ECHO) ' clean       Removes all files in the bundle derived from previous builds.'
  291.     @$(ECHO) 
  292.     @$(ECHO) ' help        Lists these targets with their descriptions.'
  293.     @$(ECHO) 
  294.     @$(ECHO) 'For more details, see the comments in /NextDeveloper/Makefiles/app/*.make.'
  295.     
  296.